3.3.46 \(\int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx\) [246]

3.3.46.1 Optimal result
3.3.46.2 Mathematica [A] (verified)
3.3.46.3 Rubi [A] (verified)
3.3.46.4 Maple [A] (verified)
3.3.46.5 Fricas [A] (verification not implemented)
3.3.46.6 Sympy [F]
3.3.46.7 Maxima [A] (verification not implemented)
3.3.46.8 Giac [B] (verification not implemented)
3.3.46.9 Mupad [B] (verification not implemented)

3.3.46.1 Optimal result

Integrand size = 29, antiderivative size = 115 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {\left (2 b c d+a \left (2 c^2+d^2\right )\right ) \text {arctanh}(\sin (e+f x))}{2 f}+\frac {2 \left (3 a c d+b \left (c^2+d^2\right )\right ) \tan (e+f x)}{3 f}+\frac {d (2 b c+3 a d) \sec (e+f x) \tan (e+f x)}{6 f}+\frac {b (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f} \]

output
1/2*(2*b*c*d+a*(2*c^2+d^2))*arctanh(sin(f*x+e))/f+2/3*(3*a*c*d+b*(c^2+d^2) 
)*tan(f*x+e)/f+1/6*d*(3*a*d+2*b*c)*sec(f*x+e)*tan(f*x+e)/f+1/3*b*(c+d*sec( 
f*x+e))^2*tan(f*x+e)/f
 
3.3.46.2 Mathematica [A] (verified)

Time = 0.45 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.77 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {3 \left (2 b c d+a \left (2 c^2+d^2\right )\right ) \text {arctanh}(\sin (e+f x))+\tan (e+f x) \left (12 a c d+6 b \left (c^2+d^2\right )+3 d (2 b c+a d) \sec (e+f x)+2 b d^2 \tan ^2(e+f x)\right )}{6 f} \]

input
Integrate[Sec[e + f*x]*(a + b*Sec[e + f*x])*(c + d*Sec[e + f*x])^2,x]
 
output
(3*(2*b*c*d + a*(2*c^2 + d^2))*ArcTanh[Sin[e + f*x]] + Tan[e + f*x]*(12*a* 
c*d + 6*b*(c^2 + d^2) + 3*d*(2*b*c + a*d)*Sec[e + f*x] + 2*b*d^2*Tan[e + f 
*x]^2))/(6*f)
 
3.3.46.3 Rubi [A] (verified)

Time = 0.69 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.05, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.345, Rules used = {3042, 4490, 3042, 4485, 3042, 4274, 3042, 4254, 24, 4257}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \csc \left (e+f x+\frac {\pi }{2}\right ) \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right ) \left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\)

\(\Big \downarrow \) 4490

\(\displaystyle \frac {1}{3} \int \sec (e+f x) (c+d \sec (e+f x)) (3 a c+2 b d+(2 b c+3 a d) \sec (e+f x))dx+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \int \csc \left (e+f x+\frac {\pi }{2}\right ) \left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right ) \left (3 a c+2 b d+(2 b c+3 a d) \csc \left (e+f x+\frac {\pi }{2}\right )\right )dx+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 4485

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \int \sec (e+f x) \left (3 \left (2 b c d+a \left (2 c^2+d^2\right )\right )+4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \sec (e+f x)\right )dx+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \int \csc \left (e+f x+\frac {\pi }{2}\right ) \left (3 \left (2 b c d+a \left (2 c^2+d^2\right )\right )+4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \csc \left (e+f x+\frac {\pi }{2}\right )\right )dx+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 4274

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \int \sec ^2(e+f x)dx+3 \left (a \left (2 c^2+d^2\right )+2 b c d\right ) \int \sec (e+f x)dx\right )+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (3 \left (a \left (2 c^2+d^2\right )+2 b c d\right ) \int \csc \left (e+f x+\frac {\pi }{2}\right )dx+4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \int \csc \left (e+f x+\frac {\pi }{2}\right )^2dx\right )+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 4254

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (3 \left (a \left (2 c^2+d^2\right )+2 b c d\right ) \int \csc \left (e+f x+\frac {\pi }{2}\right )dx-\frac {4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \int 1d(-\tan (e+f x))}{f}\right )+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 24

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (3 \left (a \left (2 c^2+d^2\right )+2 b c d\right ) \int \csc \left (e+f x+\frac {\pi }{2}\right )dx+\frac {4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \tan (e+f x)}{f}\right )+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {1}{3} \left (\frac {1}{2} \left (\frac {3 \left (a \left (2 c^2+d^2\right )+2 b c d\right ) \text {arctanh}(\sin (e+f x))}{f}+\frac {4 \left (3 a c d+b \left (c^2+d^2\right )\right ) \tan (e+f x)}{f}\right )+\frac {d (3 a d+2 b c) \tan (e+f x) \sec (e+f x)}{2 f}\right )+\frac {b \tan (e+f x) (c+d \sec (e+f x))^2}{3 f}\)

input
Int[Sec[e + f*x]*(a + b*Sec[e + f*x])*(c + d*Sec[e + f*x])^2,x]
 
output
(b*(c + d*Sec[e + f*x])^2*Tan[e + f*x])/(3*f) + ((d*(2*b*c + 3*a*d)*Sec[e 
+ f*x]*Tan[e + f*x])/(2*f) + ((3*(2*b*c*d + a*(2*c^2 + d^2))*ArcTanh[Sin[e 
 + f*x]])/f + (4*(3*a*c*d + b*(c^2 + d^2))*Tan[e + f*x])/f)/2)/3
 

3.3.46.3.1 Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4274
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_)), x_Symbol] :> Simp[a   Int[(d*Csc[e + f*x])^n, x], x] + Simp[b/d   In 
t[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]
 

rule 4485
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-b)*B*Cot[ 
e + f*x]*((d*Csc[e + f*x])^n/(f*(n + 1))), x] + Simp[1/(n + 1)   Int[(d*Csc 
[e + f*x])^n*Simp[A*a*(n + 1) + B*b*n + (A*b + B*a)*(n + 1)*Csc[e + f*x], x 
], x], x] /; FreeQ[{a, b, d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] &&  !LeQ[ 
n, -1]
 

rule 4490
Int[csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(cs 
c[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-B)*Cot[e + f*x]*(( 
a + b*Csc[e + f*x])^m/(f*(m + 1))), x] + Simp[1/(m + 1)   Int[Csc[e + f*x]* 
(a + b*Csc[e + f*x])^(m - 1)*Simp[b*B*m + a*A*(m + 1) + (a*B*m + A*b*(m + 1 
))*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, A, B, e, f}, x] && NeQ[A*b - a* 
B, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 0]
 
3.3.46.4 Maple [A] (verified)

Time = 3.40 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.03

method result size
parts \(\frac {\left (a \,d^{2}+2 b c d \right ) \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (2 a c d +b \,c^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {a \,c^{2} \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}-\frac {b \,d^{2} \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )}{f}\) \(118\)
derivativedivides \(\frac {a \,c^{2} \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+2 a c d \tan \left (f x +e \right )+a \,d^{2} \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+b \,c^{2} \tan \left (f x +e \right )+2 b c d \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-b \,d^{2} \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )}{f}\) \(143\)
default \(\frac {a \,c^{2} \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+2 a c d \tan \left (f x +e \right )+a \,d^{2} \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+b \,c^{2} \tan \left (f x +e \right )+2 b c d \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-b \,d^{2} \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )}{f}\) \(143\)
parallelrisch \(\frac {-9 \left (\cos \left (f x +e \right )+\frac {\cos \left (3 f x +3 e \right )}{3}\right ) \left (a \,c^{2}+\frac {1}{2} a \,d^{2}+b c d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )+9 \left (\cos \left (f x +e \right )+\frac {\cos \left (3 f x +3 e \right )}{3}\right ) \left (a \,c^{2}+\frac {1}{2} a \,d^{2}+b c d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )+\left (6 a c d +3 b \,c^{2}+2 b \,d^{2}\right ) \sin \left (3 f x +3 e \right )+3 \left (a \,d^{2}+2 b c d \right ) \sin \left (2 f x +2 e \right )+6 \sin \left (f x +e \right ) \left (a c d +\frac {1}{2} b \,c^{2}+b \,d^{2}\right )}{3 f \left (\cos \left (3 f x +3 e \right )+3 \cos \left (f x +e \right )\right )}\) \(197\)
norman \(\frac {\frac {4 \left (6 a c d +3 b \,c^{2}+b \,d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3 f}-\frac {\left (4 a c d -a \,d^{2}+2 b \,c^{2}-2 b c d +2 b \,d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{f}-\frac {\left (4 a c d +a \,d^{2}+2 b \,c^{2}+2 b c d +2 b \,d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )^{3}}-\frac {\left (2 a \,c^{2}+a \,d^{2}+2 b c d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{2 f}+\frac {\left (2 a \,c^{2}+a \,d^{2}+2 b c d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{2 f}\) \(207\)
risch \(-\frac {i \left (3 a \,d^{2} {\mathrm e}^{5 i \left (f x +e \right )}+6 b c d \,{\mathrm e}^{5 i \left (f x +e \right )}-12 a c d \,{\mathrm e}^{4 i \left (f x +e \right )}-6 b \,c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-24 a c d \,{\mathrm e}^{2 i \left (f x +e \right )}-12 b \,c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-12 b \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-3 a \,d^{2} {\mathrm e}^{i \left (f x +e \right )}-6 b c d \,{\mathrm e}^{i \left (f x +e \right )}-12 a c d -6 b \,c^{2}-4 b \,d^{2}\right )}{3 f \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )^{3}}-\frac {a \,c^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{f}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) d^{2}}{2 f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) b c d}{f}+\frac {a \,c^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{f}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) d^{2}}{2 f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) b c d}{f}\) \(298\)

input
int(sec(f*x+e)*(a+b*sec(f*x+e))*(c+d*sec(f*x+e))^2,x,method=_RETURNVERBOSE 
)
 
output
(a*d^2+2*b*c*d)/f*(1/2*sec(f*x+e)*tan(f*x+e)+1/2*ln(sec(f*x+e)+tan(f*x+e)) 
)+(2*a*c*d+b*c^2)/f*tan(f*x+e)+a*c^2/f*ln(sec(f*x+e)+tan(f*x+e))-b*d^2/f*( 
-2/3-1/3*sec(f*x+e)^2)*tan(f*x+e)
 
3.3.46.5 Fricas [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.30 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {3 \, {\left (2 \, a c^{2} + 2 \, b c d + a d^{2}\right )} \cos \left (f x + e\right )^{3} \log \left (\sin \left (f x + e\right ) + 1\right ) - 3 \, {\left (2 \, a c^{2} + 2 \, b c d + a d^{2}\right )} \cos \left (f x + e\right )^{3} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, {\left (2 \, b d^{2} + 2 \, {\left (3 \, b c^{2} + 6 \, a c d + 2 \, b d^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, {\left (2 \, b c d + a d^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{12 \, f \cos \left (f x + e\right )^{3}} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))*(c+d*sec(f*x+e))^2,x, algorithm="fri 
cas")
 
output
1/12*(3*(2*a*c^2 + 2*b*c*d + a*d^2)*cos(f*x + e)^3*log(sin(f*x + e) + 1) - 
 3*(2*a*c^2 + 2*b*c*d + a*d^2)*cos(f*x + e)^3*log(-sin(f*x + e) + 1) + 2*( 
2*b*d^2 + 2*(3*b*c^2 + 6*a*c*d + 2*b*d^2)*cos(f*x + e)^2 + 3*(2*b*c*d + a* 
d^2)*cos(f*x + e))*sin(f*x + e))/(f*cos(f*x + e)^3)
 
3.3.46.6 Sympy [F]

\[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\int \left (a + b \sec {\left (e + f x \right )}\right ) \left (c + d \sec {\left (e + f x \right )}\right )^{2} \sec {\left (e + f x \right )}\, dx \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))*(c+d*sec(f*x+e))**2,x)
 
output
Integral((a + b*sec(e + f*x))*(c + d*sec(e + f*x))**2*sec(e + f*x), x)
 
3.3.46.7 Maxima [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.43 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {4 \, {\left (\tan \left (f x + e\right )^{3} + 3 \, \tan \left (f x + e\right )\right )} b d^{2} - 6 \, b c d {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} - 3 \, a d^{2} {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} + 12 \, a c^{2} \log \left (\sec \left (f x + e\right ) + \tan \left (f x + e\right )\right ) + 12 \, b c^{2} \tan \left (f x + e\right ) + 24 \, a c d \tan \left (f x + e\right )}{12 \, f} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))*(c+d*sec(f*x+e))^2,x, algorithm="max 
ima")
 
output
1/12*(4*(tan(f*x + e)^3 + 3*tan(f*x + e))*b*d^2 - 6*b*c*d*(2*sin(f*x + e)/ 
(sin(f*x + e)^2 - 1) - log(sin(f*x + e) + 1) + log(sin(f*x + e) - 1)) - 3* 
a*d^2*(2*sin(f*x + e)/(sin(f*x + e)^2 - 1) - log(sin(f*x + e) + 1) + log(s 
in(f*x + e) - 1)) + 12*a*c^2*log(sec(f*x + e) + tan(f*x + e)) + 12*b*c^2*t 
an(f*x + e) + 24*a*c*d*tan(f*x + e))/f
 
3.3.46.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 294 vs. \(2 (107) = 214\).

Time = 0.34 (sec) , antiderivative size = 294, normalized size of antiderivative = 2.56 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {3 \, {\left (2 \, a c^{2} + 2 \, b c d + a d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, a c^{2} + 2 \, b c d + a d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right ) - \frac {2 \, {\left (6 \, b c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 12 \, a c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 6 \, b c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 3 \, a d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 6 \, b d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 12 \, b c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 24 \, a c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 4 \, b d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 6 \, b c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 \, a c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 \, b c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 3 \, a d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 \, b d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )}^{3}}}{6 \, f} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))*(c+d*sec(f*x+e))^2,x, algorithm="gia 
c")
 
output
1/6*(3*(2*a*c^2 + 2*b*c*d + a*d^2)*log(abs(tan(1/2*f*x + 1/2*e) + 1)) - 3* 
(2*a*c^2 + 2*b*c*d + a*d^2)*log(abs(tan(1/2*f*x + 1/2*e) - 1)) - 2*(6*b*c^ 
2*tan(1/2*f*x + 1/2*e)^5 + 12*a*c*d*tan(1/2*f*x + 1/2*e)^5 - 6*b*c*d*tan(1 
/2*f*x + 1/2*e)^5 - 3*a*d^2*tan(1/2*f*x + 1/2*e)^5 + 6*b*d^2*tan(1/2*f*x + 
 1/2*e)^5 - 12*b*c^2*tan(1/2*f*x + 1/2*e)^3 - 24*a*c*d*tan(1/2*f*x + 1/2*e 
)^3 - 4*b*d^2*tan(1/2*f*x + 1/2*e)^3 + 6*b*c^2*tan(1/2*f*x + 1/2*e) + 12*a 
*c*d*tan(1/2*f*x + 1/2*e) + 6*b*c*d*tan(1/2*f*x + 1/2*e) + 3*a*d^2*tan(1/2 
*f*x + 1/2*e) + 6*b*d^2*tan(1/2*f*x + 1/2*e))/(tan(1/2*f*x + 1/2*e)^2 - 1) 
^3)/f
 
3.3.46.9 Mupad [B] (verification not implemented)

Time = 17.02 (sec) , antiderivative size = 227, normalized size of antiderivative = 1.97 \[ \int \sec (e+f x) (a+b \sec (e+f x)) (c+d \sec (e+f x))^2 \, dx=\frac {\mathrm {atanh}\left (\frac {4\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (a\,c^2+b\,c\,d+\frac {a\,d^2}{2}\right )}{4\,a\,c^2+4\,b\,c\,d+2\,a\,d^2}\right )\,\left (2\,a\,c^2+2\,b\,c\,d+a\,d^2\right )}{f}-\frac {\left (2\,b\,c^2-a\,d^2+2\,b\,d^2+4\,a\,c\,d-2\,b\,c\,d\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5+\left (-4\,b\,c^2-8\,a\,c\,d-\frac {4\,b\,d^2}{3}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+\left (a\,d^2+2\,b\,c^2+2\,b\,d^2+4\,a\,c\,d+2\,b\,c\,d\right )\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6-3\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+3\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )} \]

input
int(((a + b/cos(e + f*x))*(c + d/cos(e + f*x))^2)/cos(e + f*x),x)
 
output
(atanh((4*tan(e/2 + (f*x)/2)*(a*c^2 + (a*d^2)/2 + b*c*d))/(4*a*c^2 + 2*a*d 
^2 + 4*b*c*d))*(2*a*c^2 + a*d^2 + 2*b*c*d))/f - (tan(e/2 + (f*x)/2)*(a*d^2 
 + 2*b*c^2 + 2*b*d^2 + 4*a*c*d + 2*b*c*d) - tan(e/2 + (f*x)/2)^3*(4*b*c^2 
+ (4*b*d^2)/3 + 8*a*c*d) + tan(e/2 + (f*x)/2)^5*(2*b*c^2 - a*d^2 + 2*b*d^2 
 + 4*a*c*d - 2*b*c*d))/(f*(3*tan(e/2 + (f*x)/2)^2 - 3*tan(e/2 + (f*x)/2)^4 
 + tan(e/2 + (f*x)/2)^6 - 1))